package it.yuzuojian.com.service.impl;

import com.github.pagehelper.PageHelper;
import it.yuzuojian.com.javaBean.Type;
import it.yuzuojian.com.mapper.TypeMapper;
import it.yuzuojian.com.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeMapper typeMapper;
    @Override
    public List<Type> findAll(int page, int pageSize) {
        PageHelper.startPage(page,pageSize);
        return typeMapper.findAll();
    }

    @Override
    public List<Type> findAll() {
        return typeMapper.findAll();
    }

    @Override
    public void add(Type type) {
        typeMapper.add(type);
    }

    @Override
    public Type findById(Integer id) {
        return typeMapper.findById(id);
    }

    @Override
    public void update(Type type) {
        typeMapper.update(type);
    }

    @Override
    public void deleteById(Integer id) {
        typeMapper.deleteById(id);
    }

    @Override
    public List<Type> findAllCount() {
        return typeMapper.findAllCount();
    }

    @Override
    public void addCount(String name) {
        typeMapper.addCount(name);
    }

    @Override
    public void deleteCount(String name) {
        typeMapper.deleteCount(name);
    }

    @Override
    public void deleteArticleTypeName(Integer id) {
        typeMapper.deleteArticleTypeName(id);
    }

    @Override
    public Integer findCounts() {
        return typeMapper.findCounts();
    }

    /*@Override
    public List<Type> findByNameWithArticle(String typeName) {
        return typeMapper.findByNameWithArticle(typeName);
    }*/
}
